package com.fowo.api.exportCenter.enums;

import com.fowo.api.exportCenter.model.ExportCenterExcelPo;
import com.fowo.api.exportCenter.model.ExportCenterSearchParamPo;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
public enum ModuleSystemEnum {

    /**
     * 导出
     */
    导出中心("exportCenter", "导出中心", ExportCenterSearchParamPo.class, "com.fowo.api.exportmodel.service.impl.ExportCenterServiceImpl", ExportCenterExcelPo.class),

    ;

    //唯一标识
    private String code;
    //导出模块名称
    private String name;
    //查询实体
    private Class<?> search;
    //映射实体
    private String clazz;
    //导入出实体
    private Class<?> entity;

    ModuleSystemEnum(String code, String name,Class<?> search, String clazz,Class<?> entity) {
        this.code = code;
        this.name = name;
        this.search = search;
        this.clazz = clazz;
        this.entity = entity;
    }

    public static ModuleSystemEnum valueOfCode(String code){
        ModuleSystemEnum[] values = ModuleSystemEnum.values();
        for (ModuleSystemEnum value : values) {
            if(StringUtils.equalsIgnoreCase(code, value.getCode())){
                return value;
            }
        }

        return null;
    }
}
